/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
function validation(){
    var count = 0;
    var mail = document.getElementsByName("email")[0].value;
    var cmail = document.getElementsByName("cemail")[0].value;
    var pwd = document.getElementsByName("password")[0].value;
    var cpwd = document.getElementsByName("cpassword")[0].value;
    
    if((document.getElementsByName("nome")[0].value) === "")
            count++;
    if((document.getElementsByName("cognome")[0].value) === "")
            count++;
    if(mail === "")
            count++;
    if(cmail === "")
            count++;
    if((document.getElementsByName("username")[0].value) === "")
            count++;
    if(pwd === "")
            count++;
    if(cpwd === "")
            count++;
    if (count !== 0){
        alert("Riempire tutti i campi obbligatori");
        return false;}
    
    
    if(mail !== cmail){
        alert("Le mail non corrispondono");
        return false;
    }
    if(pwd !== cpwd){
        alert("Le password non corrispondono");
        return false;}
        
    return true;      
}

